//
//  SmallTableViewCell.m
//  礼物go
//
//  Created by 宝银 on 16/6/5.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SmallTableViewCell.h"

@implementation SmallTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews{
    self.coverImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.coverImageView];
    //self.coverImageView.backgroundColor = [UIColor purpleColor];
    
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.numberOfLines = 0;
    //self.titleLabel.backgroundColor = [UIColor yellowColor];

}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.coverImageView.frame = CGRectMake(0, 0, self.contentView.frame.size.width / 4, self.contentView.frame.size.height);
    self.titleLabel.frame = CGRectMake(CGRectGetMaxX(self.coverImageView.frame) + 2, 0, self.contentView.frame.size.width - CGRectGetMaxX(self.coverImageView.frame) - 2, self.contentView.frame.size.height);


}


-(void)setSeleDetail:(SelectDetailModel *)seleDetail{
    _seleDetail = seleDetail;
    [self.coverImageView sd_setImageWithURL:[NSURL URLWithString:_seleDetail.cover_image_url] placeholderImage:[UIImage imageNamed:@"picholder"]];
    self.titleLabel.text = _seleDetail.title;
    
}




- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
